import Vue from 'vue'
import Router from 'vue-router'

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

export const constantRouterMap = [
  {path: '/login', component: () => import('@/views/login/index'), hidden: true},
  {path: '/404', component: () => import('@/views/404'), hidden: true},

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      component: () => import('@/views/corporate/query')
    }]
  },

  {
    path: '/corporate',
    component: Layout,
    redirect: '/corporate/query',
    name: '打印企业码',
    meta: {title: '企业码', icon: 'example'},
    alwaysShow: true,
    children: [
      {
        path: 'query',
        name: '企业码查询与打印',
        component: () => import('@/views/corporate/query'),
        meta: {title: '查询企业码', icon: 'table'}
      },
    ]
  },

  {
    path: '/business',
    component: Layout,
    redirect: '/business/query',
    name: '业务管理',
    meta: {title: '业务管理', icon: 'nested'},
    alwaysShow: true,
    children: [
      {
        path: 'query',
        name: '业务记录',
        component: () => import('@/views/business/query'),
        meta: {title: '业务记录', icon: 'form'}
      },
      {
        path: 'save',
        name: '日志记录',
        component: () => import('@/views/business/save'),
        meta: {title: '日志记录', icon: 'form'},
        hidden: true
      },
    ]
  },

  {
    path: '//admin',
    component: Layout,
    redirect: '/admin/edit',
    name: '',
    meta: {title: '', icon: 'tree'},
    hidden : true,
    children: [
      {
        path: 'edit',
        name: '',
        component: () => import('@/views/admin/edit'),
        meta: {title: '', icon: 'table'},
      },
      {
        path: 'register',
        name: '',
        component: () => import('@/views/admin/register'),
        meta: {title: '', icon: 'form'},
      },
      {
        path: 'update/:id',
        name: '',
        component: () => import('@/views/admin/register'),
        meta: {title: '', icon: 'tree'},
        hidden: true,
      }
    ]
  },

  {path: '*', redirect: '/404', hidden: true}
]



export default new Router({
  mode: 'hash', //后端支持可开
  scrollBehavior: () => ({y: 0}),
  routes: constantRouterMap,

  // beforeEach(to, from, next) {
  //
  // }

})


